/**
 * 
 */
package com.easidea.tim.entity.finance;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;
import com.easidea.tim.entity.saleorder.SaleOrder;
import com.easidea.tim.entity.system.orgnization.Staff;

/**
 * 支付记录
 * @author Harrison
 *
 */
@Entity(name="tim_finance_duefrom_payed_record")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Cache(region="tim_finance_duefrom_payed_record", usage=CacheConcurrencyStrategy.READ_WRITE)
@Undeletable(status="deleted")
public class DueFromPayedRecord extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -450597116146780812L;
	

	private Date payDate; // 支付时间
	private Double amount; // 支付金额
	private String memo; // 支付备注
	private Staff cashier; // 收款人
	private DueFrom dueFrom; // 应付信息
    private SaleOrder order;//销售订单
	@ManyToOne(cascade = CascadeType.PERSIST)
    @JoinColumn(name="sales_order_id")       
    public SaleOrder getOrder() {
		return order;
	}

	public void setOrder(SaleOrder order) {
		this.order = order;
	}	
	/**
	 * @return the payTime
	 */
	@Temporal(TemporalType.DATE)
	@Column(name="pay_date", nullable=false)
	public Date getPayDate() {
		return payDate;
	}
	/**
	 * @param payTime the payTime to set
	 */
	public void setPayDate(Date payDate) {
		this.payDate = payDate;
	}
	/**
	 * @return the amount
	 */
	@Column(name="amount" , nullable = false, columnDefinition="double not null default 0")
	public Double getAmount() {
		return amount;
	}
	/**
	 * @param amount the amount to set
	 */
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	/**
	 * @return the memo
	 */
	@Column(name="memo")
	public String getMemo() {
		return memo;
	}
	/**
	 * @param memo the memo to set
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}
	/**
	 * @return the cashier
	 */
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="cashier_id", nullable=false)
	public Staff getCashier() {
		return cashier;
	}
	/**
	 * @param cashier the cashier to set
	 */
	public void setCashier(Staff cashier) {
		this.cashier = cashier;
	}
	/**
	 * @return the dueFrom
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="duefrom_id", nullable=false)
	public DueFrom getDueFrom() {
		return dueFrom;
	}
	/**
	 * @param dueFrom the dueFrom to set
	 */
	public void setDueFrom(DueFrom dueFrom) {
		this.dueFrom = dueFrom;
	}
	
	
}
